package com.smartfactory.sail.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartfactory.sail.dto.ItemMaterialInfoDto;
import com.smartfactory.sail.entity.Item;
import com.smartfactory.sail.entity.ItemMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 产品和多个原料表 Mapper 接口
 * </p>
 *
 * @author 王巨壁
 * @since 2019-07-24
 */
@Mapper
public interface ItemMaterialMapper extends BaseMapper<ItemMaterial> {
    List<ItemMaterialInfoDto> getMaterialListByProductId(@Param("id") Long id);

    ItemMaterial getByMaterialAndProduc(@Param("materialId")Long materialId,@Param("productId")Long productId  );

    /**
     * 根据产品id 获取所有原料
     * @param itemId
     * @return
     */
    List<Item> listMaterialsByProductId(@Param("itemId")Long itemId);
}
